<?php
/************************************************************************/
/*                       DinCMS: A fresh new CMS    			        */
/*                      File:  template.class.php                       */
/* =====================================================================*/
/*                                                                      */
/* Copyright (c) 2008 by DinCMS Crew	                                */
/* http://dincms.org/                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License.       */
/*                                                                      */
/************************************************************************/


class tpl {
	private $tpl_folder = "templates/";

	private function gtpl($tpl) { 
		return str_replace("\"","\\\"",implode("",file($this->tpl_folder.$tpl.".tpl"))); 
	}
	
	public function __construct($t, $a) {
		eval ("\$display_tpl = \"".$this->gtpl($t)."\";");
		while (list($key,$value) = each($a)){
			$display_tpl = str_replace("{" . $key . "}" , $a[$key] , $display_tpl);
		}	
		echo $display_tpl;
	}
}
?>
